//
//  NSObject+FCShowTips.m
//  FactoringCheck
//
//  Created by vteam on 2016/11/15.
//  Copyright © 2016年 vteam. All rights reserved.
//

#import "NSObject+FCShowTips.h"

@implementation NSObject (FCShowTips)
- (void)showSuccessTipWith:(NSString *)title andStyle:(SVProgressHUDStyle)style{
    
    [SVProgressHUD setDefaultStyle:style];
    [SVProgressHUD showSuccessWithStatus:title];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [SVProgressHUD dismiss];
    });
    
  
}

- (void)showLoadingWihtBlackBackgroundAndString:(NSString *)title andMaskType:(SVProgressHUDMaskType)maskType{
    
    [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
    [SVProgressHUD setDefaultMaskType:maskType];
    [SVProgressHUD showWithStatus:title];
    
}

- (void)showDownLoadProgressWithString:(NSString *)title maskType:(SVProgressHUDMaskType)maskType progress:(CGFloat)progress {
    
    [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
    [SVProgressHUD setDefaultMaskType:maskType];
    [SVProgressHUD showProgress:progress status:title];
}


- (void)showErrorTipWith:(NSString *)title andStyle:(SVProgressHUDStyle)style{
    
    [SVProgressHUD setDefaultStyle:style];
    [SVProgressHUD showErrorWithStatus:title];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [SVProgressHUD dismiss];
    });
}

- (void)showProgressWithTitle:(NSString *)title andStyle:(SVProgressHUDStyle)style{
    // 修改hud样式
    [SVProgressHUD setDefaultStyle:style];
    [SVProgressHUD showWithStatus:title];
    // 设置背景有黑色遮盖的
    [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeBlack];
}

- (void)showDisminss{
    
    [SVProgressHUD dismiss];
}

- (void)showTipsWithString:(NSString *)title andStyle:(SVProgressHUDStyle)style{
    
    [SVProgressHUD setDefaultStyle:style];
    [SVProgressHUD showInfoWithStatus:title];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [SVProgressHUD dismiss];
    });
}

- (void)showTips{
    [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeGradient];
}

@end
